var pomain_tabview = null;
function open_pomain(){
	u_hideAllSections();
	u_safeShowElement('pomain_div');
	if(pomain_tabview == null){
		//pomain_tabview = new YAHOO.widget.TabView("pomain_div_inner");
	}
	init_pomaintab();
	
	if(!isNavigationFromBackButton){
	var functionPointerObj = new Object();
	functionPointerObj.functionName = "open_pomain()";
	navigationStateArray.push(functionPointerObj);
	}
	
	
}

var porcolumnDefs2 = [ {
	key : "selectThis",
	label : "Select",
	formatter : "radio",
	sortable : false
},{
	key : "orderNumber",
	label : "Order#",
	formatter : "hlinkFormatter",
	sortable : true,
	sortOptions:{sortFunction:sortByPONum}
}, {
	key : "clientNameText",
	label : "Buyer",
	sortable : true
}, {
	key : "orderDate",
	label : "Order Date",
	formatter: "date",
	sortable : true
} , {
	key : "orderAmount",
	label : "Order Amount",
	formatter: "currency"
} , {
	key : "versionNumber",
	label : "Order Version"
}];

var poscolumnDefs2 = [ {
	key : "selectThis",
	label : "Select",
	formatter : "radio",
	sortable : false
},{
	key : "orderNumber",
	label : "Order#",
	formatter : "hlinkFormatter",
	sortable : true,
	sortOptions:{sortFunction:sortByPONum}
}, {
	key : "clientNameText",
	label : "Supplier",
	sortable : true
}, {
	key : "orderDate",
	label : "Order Date",
	formatter: "date",
	sortable : true
} , {
	key : "orderAmount",
	label : "Order Amount",
	formatter: "currency"
} , {
	key : "versionNumber",
	label : "Order Version"
} ];
var por_yui_table_instance2 = null;
var pos_yui_table_instance2 = null;

function init_pomaintab(){
	por_yui_table_instance2 = create_poresults_results_table(por_yui_table_instance2,"poreceived_yui_table2",porcolumnDefs2);
	clear_poresults_results_table(por_yui_table_instance2) ;
	por_yui_table_instance2.render();
	if(poreceived_cache != null && poreceived_cache.length > 0){
		por_yui_table_instance2.addRows(poreceived_cache);
		por_yui_table_instance2.render();
		//set the sort column
		var col = por_yui_table_instance2.getColumn('orderNumber');
		//sort records here
		por_yui_table_instance2.sortColumn(col,YAHOO.widget.DataTable.CLASS_DESC );
	}
	
	pos_yui_table_instance2 = create_pos_results_table(pos_yui_table_instance2,"posent_yui_table2",poscolumnDefs2);
	clear_pos_results_table(pos_yui_table_instance2) ;
	pos_yui_table_instance2.render();
	if(posent_cache != null && posent_cache.length > 0){
		pos_yui_table_instance2.addRows(posent_cache);
		pos_yui_table_instance2.render();
		//set the sort column
		var col = pos_yui_table_instance2.getColumn('orderNumber');
		//sort records here
		pos_yui_table_instance2.sortColumn(col,YAHOO.widget.DataTable.CLASS_DESC );
	}
}